<?php

namespace app\applet\controller;

use app\BaseController;
use think\facade\Db;

class Person extends BaseController
{
    public function index(){
        $data=Db::table("wxpro_person")
            ->where("openid",$this->request->openid)
            ->where("status",1)
            ->select();
        parent::sendOutput($data);
    }

    public function add(){
        $data=request()->param();
        $openid=$this->request->openid;


        $add["openid"]=$openid;
        $add["mobile"]=$data["tel"];
        $add["name"]=$data["name"];


        $res=Db::table("wxpro_person")->insert($add);
        if($res){
            parent::sendOutput("用户添加成功");
        }else{
            parent::sendOutput("用户添加失败",500);
        }
    }
}